package javaconfig;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

//替代spring.xml配置文件，不用往xml文件中注册bean了
@Configuration  //表示该类是一个配置类
public class MySpringConfig {


  /*  <bean name="userDao" class="test.UserDao" init-method="init" destroy-method="destroy" ></bean>
*/
    //使用方法来配置bean
    @Bean
    public PersonDao personDao(){
        return new PersonDao();
    }

    @Bean
    public PersonService personService(){
        return new PersonService(personDao());
    }


}
